<table width="100%" border="0" cellspacing="5" cellpadding="5">
  <tr>
    <td width="150" ></td>
    {if $pizza.sides.0 eq 1}
    <td style="text-align:center"><img src="images/none.jpg" /><br />
      {$lang.pizzabuilder_none}</td>
    {/if}
    {if $pizza.sides.1 eq 1}
    <td  style="text-align:center"><img src="images/left.jpg" /><br />
      {$lang.pizzabuilder_left}</td>
    {/if}
    {if $pizza.sides.2 eq 1}
    <td  style="text-align:center"><img src="images/whole.jpg" /><br />
      {$lang.pizzabuilder_whole}</td>
    {/if}
    {if $pizza.sides.3 eq 1}
    <td   style="text-align:center"><img src="images/right.jpg" /><br />
      {$lang.pizzabuilder_right}</td>
    {/if} </tr>
  {foreach from=$toppings item=topping}
  <tr>
    <td width="200">
    
    {assign var=toppingsArray value=":"|explode:$topping} 
    {assign var=optionName value=$toppingsArray.0}
    {assign var=optionPrice value=$toppingsArray.1}
    {assign var=defaultchecked value=$toppingsArray.2}
    {* handle optional price and default parameters for the topping.  

      Safe to assume/require that the first element is the name 
      but, second parameter may not be price.  It may be 'default'.
      by swapping the price and default variables, we now handle the case where price is missing but default is supplied, 
      AND the case where both are supplied but in reverse order.

      *}
    
    {if $optionPrice eq "checked"}
      {assign var=optionPrice value = $defaultchecked}
      {assign var=defaultchecked value = "checked"}
    {/if}
    {assign var=option value=$optionName|cat:":"|cat:$optionPrice}
    <br>

    {$optionName}{if $optionPrice ne ""}<span style="color:green"> <em>(+{$optionPrice|price_format})</em></span>{/if}</td>
    {foreach from=$pizza.sides item=sides key=k}
      {assign var=checked value = ""}

      {if $k eq 0 and $sides eq 1}
        {assign value="None" var="side"}
        {if $defaultchecked ne "checked"}
          {assign var=checked value="checked"}
        {/if}
      {elseif $k eq 1 and $sides eq 1}
        {assign value="Left"  var="side"}
      {elseif $k eq 2 and $sides eq 1}
        {assign value="Whole"  var="side"}
        {if $defaultchecked eq "checked"}
          {assign var=checked value="checked"}
        {/if}
      {elseif $k eq 3 and $sides eq 1}
        {assign value="Right"  var="side"}
      {/if}

      {if $sides eq 1}
        <td style="text-align:center"><input class="calc{if $k ne 0} topping{/if}" type="radio" name="topping[{$option}]" {$checked} {if $k eq 0} value=""  {else} value="{$option} {$side} Side|{$side}" {/if}></td>
      {/if}
    {/foreach}
    
    
    {/foreach} </tr>
</table>
